/*
 * linux/arch/ckcore/ck6408evb/config.c
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file "COPYING" in the main directory of this archive
 * for more details.
 *
 * Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com)
 * Copyright (C) 2000, Lineo (www.lineo.com)
 * Copyright (C) 2004, Kang Sun (sunk@vlsi.zju.edu.cn)
 * Copyright (C) 2004, Li Chunqiang (chunqiang_li@c-sky.com)
 * Copyright (C) 2009, Hu Junshan (junshan_hu@c-sky.com)
 */

#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/param.h>
#include <linux/init.h>
#include <linux/rtc.h>
#include <asm/machdep.h>
#include <asm/ckcore.h>
#include <asm/delay.h>
#include <asm/mmu_context.h>

extern void ckcore_tick(void);
extern int ckcore_hwclk(int set, struct rtc_time *t);
extern void __init ckcore_timer_init(irq_handler_t handler);
extern unsigned long ckcore_timer_offset(void); 
extern void __init ckcore_init_IRQ(void); 
#ifdef CONFIG_CPU_USE_FIQ
extern void __init ckcore_init_FIQ(void); 
#endif

void __init config_BSP(char *commandp, int size)
{

#ifdef CONFIG_BOOTPARAM
	strncpy(commandp, CONFIG_BOOTPARAM_STRING, size);
	commandp[size-1] = 0;
#endif

#ifdef CONFIG_ROOTFS_INITRD
	sprintf(commandp,"root=/dev/ram0 console=ttyS0 rdinit=%s", 
		    CONFIG_INITRD_INIT_PATH);
#endif

#ifdef CONFIG_ROOTFS_JFFS2
	sprintf(commandp,"root=%s rw rootfstype=jffs2 console=ttyS0",
            CONFIG_JFFS2_ROOTDEV);
#endif

#ifdef CONFIG_ROOTFS_NFS

	sprintf(commandp,"root=/dev/nfs rw nfsroot=%s:%s v3 \
		timeo=100 ip=%s:%s:%s:%s:%s:eth0:off console=ttyS0",\
		CONFIG_STRING_NFSROOT_ADDR, CONFIG_STRING_NFSROOT_DIR, \
		CONFIG_STRING_ETH0_ADDR, CONFIG_STRING_NFSROOT_ADDR, \
		CONFIG_STRING_NETGATE_ADDR, CONFIG_STRING_ETH0_MASKADDR, \
		CONFIG_STRING_HOSTNAME);
#endif

	mach_time_init = ckcore_timer_init;
	mach_tick = ckcore_tick;
	mach_hwclk = ckcore_hwclk;
	mach_init_IRQ = ckcore_init_IRQ;
	mach_gettimeoffset = ckcore_timer_offset;
#ifdef CONFIG_CPU_USE_FIQ
	mach_init_FIQ = ckcore_init_FIQ;
#endif
}

